﻿using MediatR;
using RBAC.LuFang.API.Application.Command.UserCommand;
using RBAC.LuFang.Domain.DTO;
using RBAC.LuFang.Domin.Services;

namespace RBAC.LuFang.API.Application.CommandHandlers.UserHandler
{
    //登录
    public class UserLoginCommandHandler:IRequestHandler<UserLoginCommand, useloginDTO>
    {
        private readonly IUserService _userService;

        public UserLoginCommandHandler(IUserService userService)
        {
            _userService = userService;
        }

        public async Task<useloginDTO> Handle(UserLoginCommand request, CancellationToken cancellationToken)
        {
            return await _userService.GetLogin(request.uname, request.upwd);
        }
    }
}
